import { defineStore } from "pinia";
import { ref, computed } from "vue";

// pinia也可以使用组合式api的语法
// 使用组合式api的时候，第二个参数要写成函数
export const useCounterStore2 = defineStore("counter2", () => {
  const num = ref<number>(20);

  const doubleNum = computed<number>(() => num.value * 2);

  const increment = (): void => {
    num.value++;
  };

  // const $reset = () => {

  // }

  return {
    num,
    increment,
    doubleNum,
  };
});
